package com.monster.threadsafe;

/**
 * description:
 * 以下类的value值由于getter和setter都使用了synchronized关键字，所以是线程安全的
 * @author Yuanml on 2021/4/3 19:39
 */
public class ThreadSafeIntegerBySynchronized {
    private Integer value;

    public synchronized Integer get() {
        return value;
    }

    public synchronized void set(Integer value) {
        this.value = value;
    }
}
